<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('公文处理列表')"/>
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>

<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('document:file:edit') }]];
    var statusDatas = [[${@dict.getType('document_progress_status')}]];
    var prefix = ctx + "document/file";

    $(function () {
        var options = {
                data: [[*{documentFile}]],
             pagination: false,
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            sidePagination: "client",
                columns: [
            {
                field: 'fileId',
                title: '公文ID',
                visible: false
            },
            {
                field: 'fileName',
                title: '公文名称',
                width: '40',
                widthUnit: '%',
            },
            {
                title: '操作',
                align: 'center',
                width: '15',
                widthUnit: '%',
                formatter: function (value, row, index) {
                    var actions = [];
                    actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="previewFile(\'' + row.fileId + '\',\'' + row.fileName + '\')"><i class="fa fa-edit"></i>预览</a> ');

                    actions.push('<a class="btn btn-info btn-xs ' + statusDatas + '" href="javascript:void(0)" onclick="downloadFile(\'' + row.fileId + '\')"><i class="fa fa-anchor"></i>下载</a>');

                    return actions.join('');
                }
            }]
    };
        $.table.init(options);
    });

/*    function previewFile(index, index2){
        alert("a:" + index + " index2:" + index2);
    }*/

    function downloadFile(value) {
        window.location.href = ctx + "common/file/download?fileId=" + value;
    }

    function removeFile(){
        alert("不知道如何在逻辑上实现删除功能");
    }

</script>
</body>
</html>